<template>
  <div class="group_main">
    <el-form :model="elForm" ref="elForm">
      <el-form-item>
        <el-button type="primary" @click="getAnalysis" size="mini" icon="el-icon-search">查询</el-button>
      </el-form-item>
    </el-form>
    <el-table
      :data="analysisList"
      border
      row-key="id"
      :header-cell-style="headFirst"
      :cell-style="(res) => headFirst_col(res, [])"
    >
      <template v-for="item in Object.keys(formThead)">
        <el-table-column
          :label="formThead[item].label"
          :prop="formThead[item].prop"
          v-if="formThead[item].checked"
          :key="item"
        ></el-table-column>
      </template>
    </el-table>
  </div>
</template>
<script>
export default {
  data() {
    return {
      elForm: {},
      changeschoolid: '',
      administrator: '',
      messageType: 0,
      mType: 0,
      analysisList: [],
      formThead: {
        nameSerial: {
          label: '名单分区字节序号',
          prop: 'nameSerial',
          checked: true,
        },
        cardCount1: {
          label: '卡1分区卡数量',
          prop: 'cardCount1',
          checked: true
        },
        cardCount2: {
          label: '卡2分区卡数量',
          prop: 'cardCount2',
          checked: true
        },
        cardCount3: {
          label: '卡3分区卡数量',
          prop: 'cardCount3',
          checked: true
        },
        cardCount4: {
          label: '卡4分区卡数量',
          prop: 'cardCount4',
          checked: true
        },
        cardCount5: {
          label: '卡5分区卡数量',
          prop: 'cardCount5',
          checked: true
        },
        cardCount6: {
          label: '卡6分区卡数量',
          prop: 'cardCount6',
          checked: true
        },
        cardCount7: {
          label: '卡7分区卡数量',
          prop: 'cardCount7',
          checked: true
        },
        cardCount8: {
          label: '卡8分区卡数量',
          prop: 'cardCount8',
          checked: true
        },
        cardCount9: {
          label: '卡9分区卡数量',
          prop: 'cardCount9',
          checked: true
        },
        cardCount10: {
          label: '卡10分区卡数量',
          prop: 'cardCount10',
          checked: true
        }
      }
    }
  },
  created() {
    this.changeschoolid = this.$store.state.user.changeschoolid
    this.administrator = sessionStorage.getItem('administrator')
  },
  mounted() {
    // this.getAnalysis();
  },
  methods: {
    //获取分组列表
    getAnalysis() {
      this.$http({
        url: this.$http.adornUrl('/unit/unit-name-serial-statistics'),
        method: 'post',
        data: this.$http.adornData({
          messageContent: { unitGuid: this.changeschoolid },
          messageType: 0
        })
      }).then(({ data }) => {
        if (data.messageCode == 200) {
          console.log(data)
          this.analysisList = data.messageContent
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.group_main {
  padding: 10px;
  /deep/.el-form-item {
    margin-bottom: 0;
  }
}
</style>